//1.模拟 - 替换所有的问号
class Solution {
public:
    string modifyString(string s) {
        int n = s.size();
        for(int i = 0; i < n; i++)
        {
            if(s[i] == '?')
            {
                for(char ch = 'a'; ch <= 'z'; ch++)
                {
                    if((i == 0 || s[i - 1] != ch) && (i == n - 1 || ch != s[i + 1]))
                    {
                        s[i] = ch;
                        break;
                    }
                }
            }
        }   
        return s;
    }
};

//2.提莫攻击
class Solution {
public:
    int findPoisonedDuration(vector<int>& timeSeries, int duration) {
        int ret = 0;
        for(int i = 0; i < timeSeries.size() - 1; i++)
        {
            int gap = timeSeries[i + 1] - timeSeries[i];
            if(gap > duration) ret += duration;
            else ret += gap;
        }
        ret += duration;
        return ret;
    }
};